<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="/publico/template.xhtml">
        <ui:define name="content">
            <h:form id="fprincipal">
                <p:messages/>

                <h:inputHidden id="ihcardapioid"
                               value="#{cardapioBean.cardapio.id}" />

                <p:panel id="pprincipal" 
                         header="Composição do Cardápio">
                    <h:panelGrid id="pgprincipal"
                                 columns="1">
                        <h:outputLabel id="olnomecardapio"
                                       for="itcardapio"
                                       value="Cardápio: "/>
                        <p:inputText id="itcardapio" 
                                     value="#{cardapioBean.cardapio.nome}"
                                     required="true"/>


                        <h:outputLabel for="itens" value="Cardápio: "/>
                        <p:selectManyCheckbox id="itens" 
                                              value="#{cardapioBean.cardapio.itens}"
                                              converter="ItemConversor">
                            <f:selectItems value="#{itemBean.itens}"
                                           var="item"
                                           itemLabel="#{item.nome}"
                                           itemValue="#{item}"/>
                        </p:selectManyCheckbox>
                    </h:panelGrid>

                    <p>
                        <p:commandButton id="cbsalvar" 
                                         ajax="false"
                                         value="Salvar" 
                                         action="#{cardapioBean.salvar}"/>

                        <p:button id="cbcancelar"
                                  outcome="/admin/cardapio/lista-cardapio.xhtml"
                                  value="Cancelar"/>
                    </p>
                </p:panel> 
            </h:form>
        </ui:define>
    </ui:composition>
</html>
